package com.zengqingfa.tx;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

/**
 * @fileName: ServiceA
 * @author: zengqf3
 * @date: 2021-3-10 17:16
 * @description:
 */
public class ServiceB {

    @Transactional
    public void b() throws Exception {
        try {
            throw new Exception("eeee");
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
        }
    }
}
